package com.juc.threadPoolExecutor.threadPoolExecutor14;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ArrayBlockingQueueTest1 {

	public static void main(String[] args) {
		//ArrayBlockingQueue 使用带参构造方法
		//max 值被参考
		ArrayBlockingQueue array = new ArrayBlockingQueue(2);
		System.out.println(array.size());
		ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 3, 5, TimeUnit.SECONDS, array);
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		System.out.println(executor.getPoolSize() + "     " + array.size());
		//放入队列2个任务 执行3个任务
	}
}
